<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- 3.使用组件 -->
        <cpn></cpn>
        <cpn></cpn>
        <cpn></cpn>
    </div>
     
    <div id="app2">
        <cpn></cpn>
    </div>

    <script src='../js/vue.js'></script>
    <script>
        //1.创建组建构造器
        const cpnC = Vue.extend({
            template: `
              <div>
               <h2>我是标题</h2>
                <p>我是p</p>
                <span>我是span</span>
              </div>`
        })
        //2.全局注册
        // Vue.component('my-cpn', cpnC);
        const app = new Vue({
            el: '#app',
            //局部注册 只在app中起作用
            components:{
                cpn:cpnC
            }
        })

        const app2 = new Vue({
            el:'#app2'
        })
    </script>
</body>

</html>